/**
 * Created by Administrator on 2017/1/13.
 */
function displayAccesskeys() {
    var supported = !document.getElementsByTagName || !document.createElement || !document.createTextNode;
    if (supported) {
        return false;
    }

    var links = document.getElementsByTagName('a');
    var allKeys = [];
    for (var i = 0; i < links.length; i++) {
        var currentLink = links[i];
        var value = currentLink.getAttribute('accesskey');
        if (!value) {
            continue;
        }
        var key = currentLink.lastChild.nodeValue;
        allKeys[key] = value;
    }

    var accesskeys = document.createElement('ul');
    for (key in allKeys) {
        var text = allKeys[key];
        text = key + ': ' + text;
        var accesskey = document.createElement('li');
        text = document.createTextNode(text);
        accesskey.appendChild(text);
        accesskeys.appendChild(accesskey);
    }

    var header = document.createElement('h3');
    text = document.createTextNode('Accesskeys');
    header.appendChild(text);

    document.body.appendChild(header);
    document.body.appendChild(accesskeys);
}

addLoadEvent(displayAccesskeys);